package com.jiliang.common.exception.business;


import com.jiliang.common.exception.Errors;
import com.jiliang.common.result.WebResult;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 登录异常，未登录抛出异常
 * 错误码和错误码说明，需要指定
 * @author
 * @version v_1.0.1
 * @since
 */

@EqualsAndHashCode(callSuper = true)
@Data
public class LoginException extends RuntimeException {

    private static final long serialVersionUID = -4310721413425427596L;
    private String code;
    private String exception;
    private String msg;
    private Object object;
    private String boId;


    public LoginException() {
        super();
    }

    public LoginException(Throwable cause) {
        super(cause);
    }

    public LoginException(String code) {
        this.code = code;
    }

    public LoginException(String code, String exception, String msg) {
        super(msg);
        this.code = code;
        this.exception = exception;
        this.msg = msg;
    }

    public LoginException(String code, String exception, String msg, Object object) {
        super(msg);
        this.code = code;
        this.exception = exception;
        this.msg = msg;
        this.object = object;
    }

    public LoginException(String code, String exception, String msg, Object object, String boId) {
        super(msg);
        this.code = code;
        this.exception = exception;
        this.msg = msg;
        this.object = object;
        this.boId = boId;
    }

    public LoginException(String code, String exception, String msg, String boId) {
        super(msg);
        this.code = code;
        this.exception = exception;
        this.msg = msg;
        this.boId = boId;
    }

    public LoginException(Errors errors) {
        super(errors.msg);
        this.code = errors.code;
        this.exception = errors.exception;
        this.msg = errors.msg;
    }

    public LoginException(Errors errors, Object object) {
        super(errors.msg);
        this.code = errors.code;
        this.exception = errors.exception;
        this.msg = errors.msg;
        this.object = object;
    }

    public LoginException(WebResult webResult) {
        super(webResult.getMsg());
        this.code = webResult.getCode();
        this.exception = webResult.getException();
        this.msg = webResult.getMsg();
    }
}
